<%@ page import="model.Video" contentType="text/html"%>
<%@ page import="DAO.VideoDao" contentType="text/html"%>
<%@ page import="java.util.*" contentType="text/html"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>INTI3E Prototype</title>
		<script src="jwplayer/jwplayer.js" type="text/javascript"></script>
		<link rel="stylesheet" href="layout.css" type="text/css" />
		<jsp:include page="WEB-INF/includes/initialize.jsp"  flush="true" /> 
	</head>
	<body>
		<jsp:include page="WEB-INF/includes/menu.jsp"  flush="true" />
		<br/>
		<div id="wrapper">
			<div id="othersite">
				<object data=http://inti.janwillemslok.nl/webcam.html width="800" height="600"> 
					<embed src=http://inti.janwillemslok.nl/webcam.html width="800" height="600"> </embed> 
					Error: Embedded data could not be displayed. 
				</object>
			</div>
			<div id="record">
				<form method="post" action="CameraServlet" name="record">
					<% if (!session.getAttribute("recording").equals("true")){
					%>			
						<button name="record" value="record" >record</button>
					<%}else{ %>
			
							<button name="record" value="stop">stop</button>
					<%}%>
				</form>
				<form method="post" action="CameraServlet" name="verander">
					<select name="title">
						<% ArrayList<Video> videos1 = new ArrayList<Video>();
		             		videos1 = (ArrayList<Video>) request.getAttribute("videos");
		          	  		for(Video video1: videos1){	%>
		          				<option value="<%=video1.getName()%>"><%=video1.getName()%></option>
		          	  	<%}%>
					</select>
					<input type="text" id="description" name="description">
					<button name="record" value="verander">verander</button> 
				</form>
			</div>
			<div id="container">Loading the player ...</div>
				<script type="text/javascript">  	
					  jwplayer('container').setup({
				    'flashplayer': 'jwplayer/player.swf',
				    'id': 'playerID',
				    'width': '650',
				    'height': '240',
				    'playlist': [
						{file: "http://145.76.18.59:8080/stream.flv" , 
			 				 title: "http://145.76.18.59:8080/stream.flv",
			 				description: "live stream"
						},
				    <% 
				    	ArrayList<Video> videos = new ArrayList<Video>();
			             videos = (ArrayList<Video>) request.getAttribute("videos");
			          	  for(Video video: videos){	%>
			          	
		          	  		{file: "videos/" + '<%=video.getName()%>' + ".flv",
		          	  		 title:	'<%=video.getName()%>',
			          	  		description: '<%=video.getDescription()%>'
		          	  		},
			          	  	<%}%>
			          	  ],
				    'playlist.position': 'right',
			        'playlist.size': '320',
				    'controlbar': 'overlay'
				  });
			</script>
		</div>
		<jsp:include page="WEB-INF/includes/footer.jsp"  flush="true" />
	</body>
</html>